package com.briup.cms.dao;

import com.briup.cms.bean.Comment;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface CommentMapper {
    @Select("select * from cms_comment")
    List<Comment> selectAll();

    @Insert("insert into cms_comment values(null,#{content},#{comment_date},#{status},#{articleId},#{userId},#{parentId})")
    void insert(Comment comment);

    @Update("update cms_comment set content=#{content},comment_date=#{comment_date},status=#{status},article_id=#{parentId}," +
            "user_id=#{userId},parent_id=#{parentId} where id=#{id}")
    void update(Comment comment);

    @Delete("delete from cms_comment where id = #{id}")
    void deleteById(long id);
}
